package com.amnc.common.util;

import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;


public class SendDifData<T> {
	public  void sendData(T t,String url) {
		try {
			ResteasyClient client = new ResteasyClientBuilder().build();

			ResteasyWebTarget target = client
					.target(url);
			Response response = target.request().post(
					Entity.entity(t, "application/json"));

			if (response.getStatus() != 200) {
				throw new RuntimeException("Failed : HTTP error code : "
						+ response.getStatus());
			}
			System.out.println("Server response : \n");
			System.out.println(response.readEntity(String.class));
			response.close();

		} catch (Exception e) {

			e.printStackTrace();

		}

	}
	

}
